<?
namespace app\admin\admin;

use app\admin\dao\MessageDao;

class Sendbox Extends BaseController{

	public function index(){
		$dao=MessageDao::instance();
		$source=$dao->getsendbox(10);
		return $this->template
				->TableTemplate 
				->setData('modulename','消息管理')
				->setTitle('发件箱')
				->setPager($source->render())
				->setDataSource($source)
				->addColumnButton('delete') 
				->addNav('','发件箱',url('sendbox/index')) 
				->setPid('mbid')
				->setColumns([
					['accepter', '收件人'],
                    ['title', '标题','link','send?id=$mbid'],
                    ['createdate', '日期'],
                    ['updatetime', '更新日期'],
	                ['button', '操作', 'btn']
				])
				->fetch();
	}

	public function send(){
		$dao=MessageDao::instance();
		$source=$dao->getsendbox(10);
		$id=input('id');  
		return $this->template
				->FormTemplate 
				->setData('modulename','基础设置') 
				->addNav('','发送邮件',url('sendbox/send'),'?id='.$id)
				->setTitle('编辑管理员')
				->addFormItems([
						['text', 'accepter', '收件人', ''],
						['text', 'title', '标题', ''],

						['ueditor', 'content', '备注', ''], 
						['static', 'remsg', '回复内容', ''], 
						['hidden', 'mid', '文章标题', ''],
					])
				->setDataSource($dao->find($id))
				->setPid('mbid',$id)
				->submit('sendmsg','','','提交回复')
				->fetch();
	}
}